SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


CREATE PROCEDURE [dbo].[GetInstrumentsByFund]
	@FundID CHAR(5)
AS

SELECT DISTINCT i.InstrName, i.InstrumentId
FROM 
	FSFundModel.dbo.Instrument i
JOIN
	FSFundModel.dbo.Asset a
	ON i.InstrumentId = a.InstrumentId
JOIN	
	FSFundModel.dbo.Portfolio p	
	ON a.PortfolioId = p.PortfolioId
WHERE
	p.FundId = @FundId
ORDER BY
	i.InstrName
	
GO
EXEC sp_addextendedproperty N'VirtualFolder', N'Dbo', 'SCHEMA', N'dbo', 'PROCEDURE', N'GetInstrumentsByFund', NULL, NULL
GO
